package cn.jingzhuan.fm.di.component

import cn.jingzhuan.fm.mvp.contract.FMIndexContract
import cn.jingzhuan.fm.ui.activity.FMIndexActivity
import dagger.Module
import dagger.Provides
import dagger.Subcomponent
import dagger.android.AndroidInjector

@Subcomponent(modules = [(FMIndexModule::class)])
interface FMIndexComponent : AndroidInjector<FMIndexActivity> {

    @Subcomponent.Builder
    abstract class Builder : AndroidInjector.Builder<FMIndexActivity>() {
        abstract fun newModule(module : FMIndexModule):Builder

        override fun seedInstance(instance: FMIndexActivity) {
            newModule(FMIndexModule(instance))
        }
    }
}

@Module
class FMIndexModule(val mView: FMIndexContract.View) {
    @Provides
    fun getView() = mView
}

